// ajax渲染
class List{
    constructor(){
        this.cont = document.querySelector(".ddbox")
        console.log(this.cont)
        this.url = "http://localhost:3000/data/msg.json";
        this.load();
        console.log(this.cont)
    }
    load(){
        ajax({
            url:this.url,
            success:(res)=>{
                this.res = JSON.parse(res).msg;
                console.log(this.res);
                this.render();
            }
        })
    }
    render(){
        let str = "";
        for(let i=0;i<this.res.length;i++){
            str += `  <div class="list-b">
            <a href="spxqy.html">
             <img src="${this.res[i].img}" alt="">
             <p class="list-img">${this.res[i].proName}</p>
            <span>${this.res[i].price}</span>
           </a>
        </div>`
        }
        this.cont.innerHTML = str;
    }
}
new List()